using Examine;
using Examine.SearchCriteria;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Xml.Linq;
using System.Xml.XPath;
using Umbraco.Core.Macros;
namespace Ext.Library
{
[XsltExtension]
public class SearchHelper
{
public XPathNodeIterator Search()
{
return GetResultsAsXml(ExamineManager.Instance.Search("", false));
}
}
}
The strange thing is: When I run umbraco locally on my machine (Umbraco 7.1.6, Visual Studio 2013, ISSExpress 8.0, .NET 4.5) it is working fine. But when I run it on whe web server I get the above mentioned error (Umbraco 7.1.6, IIS 7.5.7600.16385, .NET 4.5)
The next thing I'd try would be to manually set the namespace for the XSLT extension class:
[XsltExtension("my.search")]
Then in your XSLT, change:
xmlns:ExtSearch="urn:my.search"
If that doesn't work, then Umbraco isn't picking up the extension class. From there, try selecting "skip error checks" and running the macro on the front-end, see if it gives you the same error.
I have tried so (with your example "my.search") but I get the same error (of course now with the message that the namespace 'urn:my.search' cannot be found).
I have now saved the file using the ignore error function but in the front end I get the following error: Error parsing XSLT file: \xslt\Search.xslt
There's a ticket on the issue tracker #U4-3425, about a similar issue, but it was fixed in v7.1.2. I'd suggest raising a new ticket on the issue tracker (with a reference to #U4-3425) and see if the core team can shed any light on the issue.
Using external libraries in XSLT - XslTransformException [v 7.1.6]
Hello,
I want to use an own library in a XSLT file. However, I always get the following error when I try to save the file.
My XSLT file looks like this:
And the class definition looks like this:
The strange thing is: When I run umbraco locally on my machine (Umbraco 7.1.6, Visual Studio 2013, ISSExpress 8.0, .NET 4.5) it is working fine. But when I run it on whe web server I get the above mentioned error (Umbraco 7.1.6, IIS 7.5.7600.16385, .NET 4.5)
Thank you for any help!
Regards,
mannyk
Hi mannyk,
I think the method needs to be a
static
, try this:I'm not too sure why it's running ok on your local machine though?
Cheers,
- Lee
Hello and thank you very much for your advice.
I have changed now the method to static but still I get the same error. Again, it works on local side.
Regards,
mannyk
Where is your code/class? In a compiled DLL or a file in /App_Code folder?
(I've heard about an issue with XSLT extension methods not working properly in /App_Code for v7)
Sorry for asking this next question... are you sure that the latest code is up on the web-server?
I know it sounds obvious, sorry.
Thanks,
- Lee
Hello,
The class is in a compiled DLL in the /bin folder.
Yes, I have also checked, that the latest version has been copied on the server.
Regards,
mannyk
Thanks mannyk.
The next thing I'd try would be to manually set the namespace for the XSLT extension class:
Then in your XSLT, change:
If that doesn't work, then Umbraco isn't picking up the extension class. From there, try selecting "skip error checks" and running the macro on the front-end, see if it gives you the same error.
Cheers,
- Lee
Hello and thank you for your help.
I have tried so (with your example "my.search") but I get the same error (of course now with the message that the namespace 'urn:my.search' cannot be found).
I have now saved the file using the ignore error function but in the front end I get the following error: Error parsing XSLT file: \xslt\Search.xslt
Regards,
mannyk
Hmmm... I think it might be a bug in Umbraco.
There's a ticket on the issue tracker #U4-3425, about a similar issue, but it was fixed in v7.1.2. I'd suggest raising a new ticket on the issue tracker (with a reference to #U4-3425) and see if the core team can shed any light on the issue.
Thanks,
- Lee
Okay, thank you. I will reopen this issue.
Regards,
mannyk
is working on a reply...